/**
 * Vite 配置文件。
 * 配置 React、Electron 相关插件及输出目录。
 */

import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import electron from 'vite-plugin-electron';
import renderer from 'vite-plugin-electron-renderer';

// https://vite.dev/config/
export default defineConfig({
    esbuild: {
        legalComments: 'none',
    },
    build: {
        outDir: 'dist/react',
    },
    plugins: [
        react(),
        electron([
            {
                entry: 'electron/main.ts',
                vite: {build: {outDir: 'dist/electron'}},
                onstart: (options) => options.startup(),
            },
            {
                entry: 'electron/preload.ts',
                vite: {build: {outDir: 'dist/electron'}},
                onstart: (options) => options.startup(),
            },
            {
                entry: 'electron/server.ts',
                vite: {build: {outDir: 'dist/electron'}},
                onstart: (options) => options.startup(),
            },
        ]),
        renderer(),
    ],
})
